<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const obj = {
            a: 1,
            b: 2,
            c: {
                d: undefined,
                e: null,
                f: () => { }
            }
        }
        const obj1 = {
            a:null,
            b:undefined,
            c:()=>{}
        }
        const data1 = JSON.parse(JSON.stringify(obj))
        console.log(data1,'data1')
        console.log({...obj1})
        console.log(Object.assign({},obj1,obj))
        function deepClone(data){
            if(typeof data !== 'object' || data === null) return data
            const result = Array.isArray(data) ? [] : {}
            for(let key in data){
                result[key] = deepClone(data[key])
            }
            return result
        }
        const data2 = deepClone(obj)
        obj.a = '+++'
        console.log(data2,'data2')
    </script>
</body>

</html>